<?php defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH.'route/core/Route_register.php';
require_once APPPATH.'route/core/Uri_strategy.php';

class Route
{
    static private $_register = NULL;
    
    private $_uri = NULL;
    
    public $method = '';
    
    public $directory = '';
    
    public $class = '';
    
    public $e404 = TRUE;
    
    static public function __callstatic($method, $params)
    {
        if (self::$_register === NULL)
        {
            self::$_register = new Route_register();
        }
        
        return self::$_register->attach($method, $params);
    }
    
    public function __construct()
    {
        $this->_uri = new Uri_strategy(self::$_register);
        $this->_init();
    }
    
    private function _init()
    {
        $this->directory = $this->_uri->directory;
        $this->method    = $this->_uri->method;
        $this->class     = $this->_uri->class;
//         $this->e404      = $this->_uri->e404;
    }
}